#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int w, n, digit;
int arr[30010];
bool arr_rem[30010];

int compare(const void* p1, const void* p2)
{
	if (*(int*)p1 < *(int*)p2)return 1;
	else return -1;
}

int main()
{
	cin >> w >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
	}
	qsort(arr, n, sizeof(int), compare);
	int left = 0;
	while (left < n) {
		if (arr_rem[left]) {
			left++;
			continue;
		}
		for (int i = left + 1; i < n; i++) {
			if (arr_rem[i])continue;
			if (arr[i] + arr[left] <= w) {
				digit++;
				arr_rem[i] = arr_rem[left] = 1;
				break;
			}
		}
		if (arr_rem[left] == 0)digit++;
		left++;
	}
	cout << digit;
	return 0;
}